package com.yangming.springboot.deepin.playTest;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.concurrent.TimeUnit;

/**
 * @创建人 ym
 * @创建时间 2021/4/7 0007
 * @描述
 **/
public class Deprecated {

    public static void main(String[] args) throws Exception{
        DateFormat format = new SimpleDateFormat("HH:mm:ss");
        Thread printThread = new Thread(new Runner(), "printThread");
        printThread.setDaemon(true);
        printThread.start();
        TimeUnit.SECONDS.sleep(3);
        printThread.suspend();
        System.out.println("mian suspend" + format.format(new Date()));
        TimeUnit.SECONDS.sleep(3);
        printThread.resume();
        System.out.println("mian resume" + format.format(new Date()));
        TimeUnit.SECONDS.sleep(3);
        printThread.stop();
        System.out.println("mian stop" + format.format(new Date()));
        TimeUnit.SECONDS.sleep(3);
    }

    public static class Runner implements Runnable{
        @Override
        public void run(){
            DateFormat format = new SimpleDateFormat("HH:mm:ss");
            while(true){
                System.out.println(Thread.currentThread().getName() + " run at " + format.format(new Date()));
                SleepUtils.second(1);
            }
        }
    }

}
